package com.nondo.dean.community.controller.api.app;

import com.nondo.dean.common.annotation.ApiVersion;
import com.nondo.dean.common.tool.BeanUtils;
import com.nondo.dean.common.web.Page;
import com.nondo.dean.common.web.Query;
import com.nondo.dean.common.web.View;
import com.nondo.dean.community.domain.Category;
import com.nondo.dean.community.model.CategoryBean;
import com.nondo.dean.community.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author ken.
 * @version 1.0
 * @email 695093513@qq.com
 * @date 2018/3/28
 */
@RestController("apiAppCommunityCategory")
@RequestMapping("/{v}/app/category")
public class CategoryController {
    @Autowired
    CategoryService categoryService;

    /**
     * 列表
     *
     * @param request
     * @param response
     * @param category
     * @return
     */
    @ApiVersion(1)
    @RequestMapping("/list")
    public View list(HttpServletRequest request, HttpServletResponse response, @RequestBody Category category) {
        View view = new View(20000, "获取数据成功");

        List<Category> caregoryList = categoryService.getList(category);

        view.setData(caregoryList);

        return view;
    }
}
